package com.oocl.o2o.client.entity;

import java.util.ArrayList;
import java.util.List;

import javax.persistence.CollectionTable;
import javax.persistence.Column;
import javax.persistence.ElementCollection;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.OneToMany;

import org.hibernate.annotations.GenericGenerator;

import com.fasterxml.jackson.annotation.JsonIgnore;


@Entity
@GenericGenerator(name = "customer_id_generator", strategy = "uuid")
public class Customer {
	@Id
	@GeneratedValue(generator="customer_id_generator")
	@Column(columnDefinition="char(32)")
	private String id;
	private String username;
	private String password;
	
	@OneToMany(mappedBy = "customer")
	//  the list is read only, but the element in list not read only
	@JsonIgnore
	List<ReceiverInfo> receiverInfos = new ArrayList<ReceiverInfo>();

	@OneToMany(mappedBy = "customer")
	//  the list is read only, but the element in list not read only
	@JsonIgnore
	List<Commentary> comments = new ArrayList<Commentary>();

	@OneToMany(mappedBy = "customer")
	@JsonIgnore
	//  the list is read only, but the element in list not read only
	List<OrderInfo> orderInfos = new ArrayList<OrderInfo>();

	public Customer() {
	}

	// Not support change the list ,but you can change the list element data.
	public Customer( String username, String password) {
		this.username = username;
		this.password = password;
	}

	public String getId() {
		return id;
	}

	public String getUsername() {
		return username;
	}

	public void setUsername(String username) {
		this.username = username;
	}

	public String getPassword() {
		return password;
	}

	public void setPassword(String password) {
		this.password = password;
	}

	public List<ReceiverInfo> getReceiverInfos() {
		return receiverInfos;
	}

	public void setReceiverInfos(List<ReceiverInfo> receiverInfos) {
		this.receiverInfos = receiverInfos;
	}

	

	public List<Commentary> getComments() {
		return comments;
	}

	public void setComments(List<Commentary> comments) {
		this.comments = comments;
	}

	public void setId(String id) {
		this.id = id;
	}

	public List<OrderInfo> getOrderInfos() {
		return orderInfos;
	}

	public void setOrderInfos(List<OrderInfo> orderInfos) {
		this.orderInfos = orderInfos;
	}
	
	
	
	
}
